#if !defined(Prota_BlurFunctions_h)
#define Prota_BlurFunctions_h

static const float c[] = {
    0.011, 0.022, 0.032, 0.027, 0.025, 0.033, 0.045, 0.063, 0.09, 0.13, 0.17, 0.21
};

void BlurHorizontal_float(in UnityTexture2D tex, in float2 texel, in float2 uv, in float scale, in float mult, out float4 color)
{
    float4 total = float4(0.0, 0.0, 0.0, 0.0);
    float sum = 0.0;
    for(int i = -11; i <= 11; i++)
    {
        int k = 11 - abs(i);
        float2 offset = float2(i * texel.x * scale, 0);
        total += c[k] * tex2D(tex, uv + offset);
        sum += c[k];
    }

    color = total / sum * mult;
}

void BlurVertical_float(in UnityTexture2D tex, in float2 texel, in float2 uv, in float scale, in float mult, out float4 color)
{
    float4 total = float4(0.0, 0.0, 0.0, 0.0);
    float sum = 0.0;
    for(int i = -11; i <= 11; i++)
    {
        int k = 11 - abs(i);
        float2 offset = float2(0, i * texel.y * scale);
        total += c[k] * tex2D(tex, uv + offset);
        sum += c[k];
    }

    color = total / sum * mult;
}

#endif // Prota_BlurFunctions_h
